package cn.cgg.transaction;

import org.apache.rocketmq.client.producer.LocalTransactionState;
import org.apache.rocketmq.client.producer.TransactionListener;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.common.message.MessageExt;

public class MyTransactionCheckListener implements TransactionListener {

    @Override
    public LocalTransactionState executeLocalTransaction(Message message, Object o) {
        //执行业务，保存本地事务

        //保存成功
        return LocalTransactionState.COMMIT_MESSAGE ; //ROLLBACK_MESSAGE;    //未知
    }

    @Override
    public LocalTransactionState checkLocalTransaction(MessageExt messageExt) {
        //这里查询本地事务状态
        return LocalTransactionState.COMMIT_MESSAGE;
    }
}
